﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace YourWallet
{
    public enum TransactionType { Income = 1, Expense = 2}

    public class Transaction
    {
        string accountName;
        DateTime date;
	    double amount;
	    string category;
	    string note;
        TransactionType type;

        public Transaction(string accountName, double amount, string category,
            DateTime date, string note, TransactionType type)
        {
            this.accountName = accountName;
            this.amount = amount;
            this.category = category;
            this.note = note;
            this.date = date;
            this.type = type;
        }

        #region Getteers

        public string GetAccountName()
        {
            return accountName;
        }

        public DateTime GetDate()
        {
            return date;
        }

	    public double GetAmount()
        {
            return amount;
        }

        public string GetCategory()
        {
            return category;
        }

        public  string GetNote()
        {
            return note;
        }

        public string GetName()
        {
            return HasNote() ? GetNote() : GetCategory();
        }

        public TransactionType GetTransactionType()
        {
            return type;
        }

        #endregion
        
        #region Setteers

        public void SetParameters(string accountName, double amount, string category,
            DateTime date, string note, TransactionType type)
        {
            this.accountName = accountName;
            this.amount = amount;
            this.category = category;
            this.note = note;
            this.date = date;
            this.type = type;
        }

        public void SetAccountName(string accountName)
        {
            this.accountName = accountName;
        }

        public void SetDate(DateTime date)
        {
            this.date = date;
        }

        public void SetAmount(double amount)
        {
            this.amount = amount;
        }

        public void SetCategory(string category)
        {
            this.category = category;
        }

        public void SetNote(string note)
        {
            this.note = note;
        }

        public void SetType(TransactionType type)
        {
            this.type = type;
        }

        #endregion

        private bool HasNote()
        {
            return note != "";

        }
        public bool IsExpense()
        {
            return GetTransactionType() == TransactionType.Expense;
        }

        public bool IsIncome()
        {
            return GetTransactionType() == TransactionType.Income;
        }
    }
}
